package com.nbstar.film.spider.excel;

import com.nbstar.film.spider.pojo.RawFromExcel;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;

public class SiChuanExcelReader extends XSSFExcelReader {
    public static final int COL_INDEX_SEQ_NO_ = 0;
    public static final int COL_INDEX_FILMNAME_ = 2;
    public static final int COL_INDEX_COPYRIGHT_NUM = 12;
    public static final int COL_INDEX_COPYRIGHT_VALIDATE = 13;
    public static final int COL_INDEX_COPYRIGHT_BRIGHTSPOT = 19;

    @Override
    public RawFromExcel readRowFromExcel(XSSFRow row) {
        RawFromExcel  rawFromExcel = new RawFromExcel();
        rawFromExcel.setFilmName((String) getCellValue(row, COL_INDEX_FILMNAME_));
        try {
            rawFromExcel.setSeqNo((int) Double.parseDouble(getCellValue(row, COL_INDEX_SEQ_NO_)));
        } catch (Exception e) {
            rawFromExcel.setSeqNo(0);
        }
        rawFromExcel.setCopyrightNumber(getCellValue(row, COL_INDEX_COPYRIGHT_NUM));
        rawFromExcel.setCopyrightValidDate(getCellValue(row, COL_INDEX_COPYRIGHT_VALIDATE));
        rawFromExcel.setBrightSpot(getCellValue(row, COL_INDEX_COPYRIGHT_BRIGHTSPOT));
        return rawFromExcel;
    }
}
